<?php

namespace App\Http\Requests\DeviceController;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class StoreRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'total' => ['required', Rule::in([1, 3, 5, 10])],
            'pay_password' => ['required', 'payPassword']
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'total.required' => __('套餐类型不能为空'),
            'total.in' => __('套餐类型必须是1，3，5，10中的一个'),
            'pay_password.required' => __('支付密码不能为空'),
        ];
    }
}
